<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/mytag.jspf"%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>商品管理</title>
<script type="text/javascript">
$(function() {
	$("form").validate({
		rules : {
			"no" : {
				required : true,
				remote : { // 异步验证是否存在
					type : "POST",
					url : 'management/mdse/isExist',
					data : {
						no : function() {
							return $("#no").val();
						}
					}
				}
			},
			"name" : {
				required : true,
				remote : { // 异步验证是否存在
					type : "POST",
					url : 'management/mdse/isExist',
					data : {
						name : function() {
							return $("#name").val();
						}
					}
				}
			},
			"category" : {
				required : true
			},
			"vipPrice" : {
				required : true,
				isPriceOne:true
			},
			"noVipPrice" : {
				required : true,
				isPriceOne:true
			}
		},
		messages : {
			"no" : {
				required : "请输入商品编号",
				remote : "该商品编号已经存在"
			},
			"name" : {
				required : "请输入商品名称",
				remote : "该商品名称已经存在"
			},
			"category" : {
				required : "请选择商品类别"
			},
			"vipPrice" : {
				required : "请输入会员价"
			},
			"noVipPrice" : {
				required : "请输入非会员价"
			}
		}
	});
});
</script>
</head>
<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li><a href="management/mdse/index">商品管理</a></li>
		<li class="am-active">新增</li>
	</ol>
	<div class="am-g">
		<div class="am-u-md-12">
			<form class="am-form am-form-horizontal" id="form" name="form"  method="post" action="management/mdse/save">
			<div class="am-tabs am-margin">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="javascript:void(0)">基本信息</a></li>
					</ul>
					<div class="am-tabs-bd">
						<div class="am-tab-panel am-active">
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">商品编号</label>
								<div class="am-u-md-4 am-u-end">
									<input type="text" id="no" name="no" class="am-form-field am-input-sm" maxlength="30">
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">商品名称</label>
								<div class="am-u-md-4 am-u-end">
									<input type="text" id="name" name="name" class="am-form-field am-input-sm" maxlength="20">
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">商品类别</label>
								<div class="am-u-md-4 am-u-end">
          							<t:dictSelect tabName="mdse" colName="category" field="category" id="category"></t:dictSelect>
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">会员价</label>
								<div class="am-u-md-4 am-u-end">
									<input type="text" id="vipPrice" name="vipPrice" class="am-form-field am-input-sm" maxlength="10">
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">非会员价</label>
								<div class="am-u-md-4 am-u-end">
									<input type="text" id="noVipPrice" name="noVipPrice" class="am-form-field am-input-sm" maxlength="10">
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="am-margin">
					<button class="am-btn am-btn-primary am-btn-xs" type="submit"><span class="am-icon-check"></span> 保存</button>
					<a href="javascript:;" onClick="javascript:history.back(-1);" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 取消</a>
				</div>
			</form>
		</div>
	</div>
</body>
</html>
